from django.db import models

from apps.utils.model import BaseModel




class BasicInfo(BaseModel):
    year = models.CharField(max_length=6, verbose_name='年份')
    season_code = models.CharField(max_length=6, verbose_name="季度编码")
    refund = models.DecimalField(max_digits=14, decimal_places=2, verbose_name="返款金额")
    wrong_refund = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='异常返款金额')
    repeat_amount = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='订单重复金额')
    modify_amount = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='订单篡改金额')
    order_date = models.DateTimeField()

    def get_season_code(self):
        pass


class DeptRefund(BaseModel):
    year = models.CharField(max_length=4, verbose_name='年份')
    dept_name = models.CharField(max_length=100, verbose_name='部门名称')
    dept_amount = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='返款金额')

class DealerRefund(BaseModel):
    pass




class BasicSeasonInfo(BaseModel):
    # 季度编码：202001，2020年第一季度
    season_code = models.CharField(max_length=6, verbose_name="季度编码")
    season_refund = models.DecimalField(max_digits=14, decimal_places=2, verbose_name="季度返款金额")
    season_wrong_refund = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='季度异常返款金额')
    season_repeat_amount = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='季度订单重复金额')
    season_modify_amount = models.DecimalField(max_digits=14, decimal_places=2, verbose_name='季度订单篡改金额')


class BasicYearInfo(models.Model):
    year = models.CharField(max_length=6, verbose_name='年份')
    # 返款金额
    year_refund = models.DecimalField(max_digits=14, decimal_places=2)
    # 异常返款金额
    year_wrong_refund = models.DecimalField(max_digits=14, decimal_places=2)
    # 订单重复金额
    year_repeat_amount = models.DecimalField(max_digits=14, decimal_places=2)
    # 订单篡改金额
    year_modify_amount = models.DecimalField(max_digits=14, decimal_places=2)
    # 数据更新时间
    update_time = models.DateTimeField()
